package com.example.demo.controller;

import com.example.demo.entity.Class;
import com.example.demo.service.ClassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/class")
public class ClassController {
    @Autowired
    ClassService classService;

    @GetMapping("/all/")
    public List<Class> findAll() {
        return classService.findAll();
    }

    @GetMapping("/get/{id}")
    public Class findById(@PathVariable("id") Integer id) {
        return classService.findById(id);
    }
}
